<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
#box {
	position: relative;
	width: 10px;
	height: 10px;
	margin: 200px auto;
	background: blue;
}
#box div {
	position: absolute;
	left: 50%;
	top: 50%;
	margin: -1px 0 0 -50px;
	width: 100px;
	height: 2px;
	background: red;
}
/*
	正N边形外角和 = 360
	正N边形外角 = 360/n
	正N边形内角 = 180 - 360/n

	正弦 Math.sin() 直角三角形中 对边和斜边的比值
	余弦 Math.cos() 直角三角形中 临边和斜边的比值 
	正切 Math.tan() 直角三角形中 对边和临边的比值 

	已知角度，和临边 求对边
	Math.tan(弧度)*临边 = 对边

	弧度 = 角度*Math.PI/180;

	对边 = Math.tan(角度*Math.PI/180)*临边 	
*/
</style>
<script type="text/javascript" src="js/m.Tween.js"></script>
<script type="text/javascript">
	//console.log(); 87
	window.onload = function(){
		var div = document.querySelectorAll('#box div');
		var deg = 360 / div.length;
		var width = div[0].offsetWidth;
		var R = Math.round(Math.tan(deg*Math.PI/180)*(width/2));
		for(var i = 0; i < div.length; i++){
			var divDeg = i * deg;
			var  x = Math.sin(divDeg*Math.PI/180)*R;
			var  y = Math.cos(divDeg*Math.PI/180)*R;
			css(div[i],"translateX",x);
			css(div[i],"translateY",y);
			css(div[i],"rotate",-divDeg);
		}
	};
</script>
</head>
<body>
<div id="box">
	<div></div>
	<div></div>
	<div></div>
	<div></div>
	<div></div>
	<div></div>
</div>	
</body>
</html>